<?php
class Contenidos extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->helper(array(
            'url'
        ));
        $this->load->model(array(
            'panel_model',
            'team_model'
        ));
    }
    
    public function index($seccion) {
        
        $id = $this->panel_model->get_id_contenido($seccion);
        $flag = 0;
        if(empty($id['idcontenido'])) {
            show_404();
        } else {
            $data['contenido'] = $this->panel_model->get_contenido_por_parametros($seccion);
            
            
            if($seccion != 'home') {
                $this->load->view('layout/header', $data);
            }
            
            switch ($seccion) {
                case 'home';
                    $this->load->view('layout/home');
                    break;
                case 'overview-what-we-do':
                case 'agribusiness':
                case 'private-capital-advisory':
                case 'real-estate':
                case 'welth-managment':
                case 'what-we-do':
                case 'investment-banking':
                    $this->load->view('layout/submenu-what-we-do');
                    break;
                case 'who-we-are':
                case 'overview-who-we-are':
                case 'advisory-board':
                case 'team':
                    $d['team'] = $this->team_model->gets('team');
                    $d['advisory'] = $this->team_model->gets('advisory-board');
                    $this->load->view('layout/submenu-who-we-are', $d);
                    break;
                case 'why-we-do-it':
                case 'overview-why-we-do-it':
                case 'merchant-bank':
                case 'guiding-principles':
                    $this->load->view('layout/submenu-why-we-do-it');
                    break;
                case 'investors':
                    $this->load->view('layout/investors');
                    $this->load->view('layout/frases');
                    $this->load->view('layout/footer');
                    break;
                case 'info':
                case 'our-services':
                case 'investment-management':
                case 'information-management':
                case 'trust-legal-service':
                case 'lifestyle-management':
                    $flag = 1;
                    $this->load->view('layout/submenu-what-we-do');
                    $this->load->view('layout/contenido_sin_foto');
                    $this->load->view('layout/frases');
                    $this->load->view('layout/footer');
            }
            if($seccion != 'home' && $seccion != 'investors' && $flag == 0) {
                $this->load->view('layout/contenido');
                $this->load->view('layout/frases');
                $this->load->view('layout/footer');
            }
        }
    }
}
?>
